﻿using System.Windows;
using Jade.Tools.SL.Windows.Extensions;
using System;

namespace Jade.Tools.SL.Windows
{
    /// <summary>
    /// See Custom Message
    /// </summary>
    public sealed class CustomMessageBox
    {
        public static MessageBoxResult Show(Action<MessageBoxResult> closeCallback, string messageBoxText)
        {
            return Show(closeCallback, messageBoxText, "", MessageBoxButton.OK, MessageBoxImage.None);
        }

        public static MessageBoxResult Show(Action<MessageBoxResult> closeCallback, string messageBoxText, string caption)
        {
            return Show(closeCallback, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None);
        }

        public static MessageBoxResult Show(Action<MessageBoxResult> closeCallback, string messageBoxText, string caption, MessageBoxButton button)
        {
            return Show(closeCallback, messageBoxText, caption, button, MessageBoxImage.None);
        }

        public static MessageBoxResult Show(Action<MessageBoxResult> closeCallback, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
        {
            ChildCustomDialog customWindowDialog = new ChildCustomDialog();
            customWindowDialog.TxMessage = messageBoxText;
            customWindowDialog.Title = caption;
            customWindowDialog.Button = button;
            customWindowDialog.IconMessage = icon;
            customWindowDialog.Closed += (sender, e) =>
            {
                if (closeCallback != null) { closeCallback(customWindowDialog.MessageBoxResult); }
            };
            customWindowDialog.Show();
            return customWindowDialog.MessageBoxResult;
        }

    }
}
